function scaledEfficiency = kunchenko2D(template, signal, step)
%KUNCHENKO2D template matching using Kunchenko Polynomials for 2D case.
import kunchenko.*;

cardinalFunctionIndex = 2;

generativeTransformsWithIncludedCardinalFunction{1} = @(x)x.^0;
generativeTransformsWithIncludedCardinalFunction{2} = @(x)x.^2;
generativeTransformsWithIncludedCardinalFunction{3} = @(x)x.^3;
generativeTransformsWithIncludedCardinalFunction{4} = @(x)x.^4;
generativeTransformsWithIncludedCardinalFunction{5} = @(x)x.^5;

correlantCalculator = kunchenko.twodimentional.CorrelantCalculator();

generatedFunctionsSystem = GeneratedFunctionsSystem.build(template, step, generativeTransformsWithIncludedCardinalFunction, cardinalFunctionIndex, correlantCalculator);

matcher = KunchenkoTemplateMatcher(signal, generatedFunctionsSystem);
result = matcher.match();
scaledEfficiency = scale2DEffectogram(result.effectogram, size(template), size(signal), 0);
end

